package one;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;

public class WordBank 
{
	public static void main(String[] args)
	{
		ArrayList<String> a = getWords("words.txt");
	for (String s: a)
	{
		System.out.println(s);
	}
	}
	
	public static ArrayList<String> getWords(String filepath)
	{
		ArrayList<String> result = new ArrayList();
		try
		{
		
		FileInputStream fis = new FileInputStream(filepath);
		BufferedReader bf = new BufferedReader(new FileReader(filepath));
		
		boolean b = true;
		while(b)
		{
			String s = bf.readLine();
			if (s != null)
			{
				result.add(s);
			}
			else
			{
				b = false;
			}
		}

		}
		
		catch(FileNotFoundException e)
		{
		System.out.println("error");
		}
		
		catch(IOException e)
		{
			System.out.println("error");
		}
		
		return result;
		
	}
}
